import React, { Component } from 'react'
import Header from "./common/header"
import { Provider } from "react-redux"
import { BrowserRouter, Route, Redirect, Switch } from "react-router-dom"
import store from "./store"

import Home from "./views/home"
import Detail from "./views/detail/load"
import Login from "./views/login"
import Write from "./views/writer"
import Error from "./views/error"

export default class App extends Component {
    render() {
        return (
            <div>
                <Provider store={store}>
                    <BrowserRouter>
                        <Header />
                        <Switch>
                            <Route path="/" exact component={Home}></Route>
                            <Route path="/login" exact component={Login}></Route>
                            <Route path="/write" exact component={Write}></Route>
                            <Route path="/detail/:id" exact component={Detail}></Route>
                            <Route path="/error" exact component={Error}></Route>
                            <Redirect to="/"></Redirect>
                        </Switch>
                    </BrowserRouter>
                </Provider>
            </div>
        )
    }
}
